<template>
  <div class="backlog">
    <div class="subject">待办信息</div>

    <div class="item-list">
      <el-row :gutter="30">
        <el-col :span="8">
            <router-link :to="{name: 'ManageStorageInList'}">
              <item
                icon="icon_db_rukudan2x"
                title="入库单"
                primaryColor="#0076FF"
                :leftVal="inData.value1"
                :rightVal="inData.value2"
              />
            </router-link>
        </el-col>
        <el-col :span="8">
          <router-link :to="{name: 'ManageStorageOutList'}">
            <item
              icon="icon_db_chukudan2x"
              title="出库单"
              primaryColor="#FFB200"
              :leftVal="outData.value1"
              :rightVal="outData.value2"
            />
          </router-link>
        </el-col>
        <el-col :span="8">
          <router-link :to="{name: 'CheckList'}">
            <item
              icon="icon_db_pandiandan2x"
              title="盘点单"
              primaryColor="#FF7100"
              :leftVal="checkData.value1"
              :rightVal="checkData.value2"
            />
          </router-link>
        </el-col>
      </el-row>
    </div>
  </div>
</template>

<script lang="ts">
import { getTodoInformation } from '@/module-base/api/dashboard'
import { Component, Vue } from 'vue-property-decorator'
import Item from './item/index.vue'

@Component({
  name: 'Notes',
  components: {
    Item
  }
})
export default class extends Vue {
  private inData = []

  private outData = []

  private checkData = []

  created() {
    this.initData()
  }

  private async initData() {
    const { data } = await getTodoInformation()
    for (const item of data) {
      if (item.name.indexOf('入') > -1) {
        this.inData = item
      }
      if (item.name.indexOf('出') > -1) {
        this.outData = item
      }
      if (item.name.indexOf('盘点') > -1) {
        this.checkData = item
      }
    }
  }
}
</script>

<style lang="scss" scoped>
@import 'index';
</style>
